package com.sunqianhu.design_patterns_23.behavioral.iterator;

public class Client {
    public static void main(String[] args) {
        ConcreteAggregate aggregate = new ConcreteAggregate();
        aggregate.addBook(new Book("java"));
        aggregate.addBook(new Book("python"));
        aggregate.addBook(new Book("c++"));
        Iterator<Book> iterator = aggregate.createIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next().getName());
        }
    }
}
